package com.yuexunit.operationman.nbsy.module.OperationBeforeAndAfter.ui;

import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.TextView;

import com.alibaba.fastjson.JSON;
import com.bumptech.glide.Glide;

import com.yuexunit.operationman.nbsy.R;
import com.yuexunit.operationman.nbsy.base.BaseKJActivity;
import com.yuexunit.operationman.nbsy.base.ExitApplication;
import com.yuexunit.operationman.nbsy.base.SubmitBean;
import com.yuexunit.operationman.nbsy.config.AppConfig;
import com.yuexunit.operationman.nbsy.module.OperationBeforeAndAfter.model.impl.BeforeAndAfterModel;
import com.yuexunit.operationman.nbsy.module.OperationBeforeAndAfter.presenter.IBeforeAndAfterPresenter;
import com.yuexunit.operationman.nbsy.module.OperationBeforeAndAfter.presenter.impl.BeforeAndAfterPresenter;
import com.yuexunit.operationman.nbsy.module.OperationBeforeAndAfter.ui.view.IBeforeAndAfterView;
import com.yuexunit.operationman.nbsy.module.SafeOperation.bean.SignBean;
import com.yuexunit.operationman.nbsy.module.SafeOperation.model.impl.SafeOperationSignModel;
import com.yuexunit.operationman.nbsy.module.SafeOperation.presenter.ISafeOperationSignPresenter;
import com.yuexunit.operationman.nbsy.module.SafeOperation.presenter.impl.SafeOperationSignPresenter;
import com.yuexunit.operationman.nbsy.module.SafeOperation.ui.view.ISafeOperationSignView;
import com.yuexunit.operationman.nbsy.widget.ActionSheetDialog;
import com.yuexunit.operationman.nbsy.widget.ClickDialog;
import com.yuexunit.operationman.nbsy.widget.LoadingDialog;
import com.yuexunit.operationman.nbsy.widget.LoginDialog;

import org.kymjs.kjframe.ui.ViewInject;
import org.kymjs.kjframe.utils.PreferenceHelper;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by chenss on 2017/11/8 0008.
 */

public class Act_OperationBeforeAndAfter_BeforeVisit extends BaseKJActivity implements IBeforeAndAfterView, ISafeOperationSignView {

    @Bind(R.id.tv_patient_name)
    TextView tvPatientName;
    @Bind(R.id.tv_patient_sex)
    TextView tvPatientSex;
    @Bind(R.id.tv_patient_visitno)
    TextView tvPatientVisitno;
    @Bind(R.id.tv_patient_disease)
    TextView tvPatientDisease;
    @Bind(R.id.bv_01)
    EditText bv01;
    @Bind(R.id.bv_02)
    EditText bv02;
    @Bind(R.id.bv_03)
    EditText bv03;
    @Bind(R.id.bv_04)
    EditText bv04;
    @Bind(R.id.bv_0501)
    EditText bv0501;
    @Bind(R.id.bv_0502)
    EditText bv0502;
    @Bind(R.id.bv_0503)
    EditText bv0503;
    @Bind(R.id.bv_0504)
    EditText bv0504;
    @Bind(R.id.bv_0505)
    EditText bv0505;
    @Bind(R.id.bv_0506)
    EditText bv0506;
    @Bind(R.id.bv_0507)
    EditText bv0507;
    @Bind(R.id.bv_0601)
    RadioButton bv0601;
    @Bind(R.id.bv_0602)
    RadioButton bv0602;
    @Bind(R.id.bv_0603)
    EditText bv0603;
    @Bind(R.id.bv_070101)
    RadioButton bv070101;
    @Bind(R.id.bv_070102)
    RadioButton bv070102;
    @Bind(R.id.bv_070103)
    RadioButton bv070103;
    @Bind(R.id.bv_0702)
    CheckBox bv0702;
    @Bind(R.id.bv_0703)
    CheckBox bv0703;
    @Bind(R.id.bv_0704)
    CheckBox bv0704;
    @Bind(R.id.bv_070501)
    CheckBox bv070501;
    @Bind(R.id.bv_070502)
    CheckBox bv070502;
    @Bind(R.id.bv_070503)
    CheckBox bv070503;
    @Bind(R.id.bv_070504)
    CheckBox bv070504;
    @Bind(R.id.bv_070505)
    CheckBox bv070505;
    @Bind(R.id.bv_070506)
    CheckBox bv070506;
    @Bind(R.id.bv_0801)
    CheckBox bv0801;
    @Bind(R.id.bv_0802)
    CheckBox bv0802;
    @Bind(R.id.bv_0803)
    CheckBox bv0803;
    @Bind(R.id.bv_0804)
    CheckBox bv0804;
    @Bind(R.id.bv_0805)
    CheckBox bv0805;
    @Bind(R.id.bv_0806)
    CheckBox bv0806;
    @Bind(R.id.bv_0807)
    CheckBox bv0807;
    @Bind(R.id.sure)
    TextView sure;
    @Bind(R.id.bv_0807_other)
    EditText bv0807Other;
    @Bind(R.id.bv_0807_other_ll)
    LinearLayout bv0807OtherLl;

    //签名
    @Bind(R.id.img_sign_visit)
    ImageView imgSignVisit;
    @Bind(R.id.tv_sign_visit_time)
    TextView tvSignVisitTime;
    @Bind(R.id.tv_sign_visit_name)
    TextView tvSignVisitName;
    @Bind(R.id.btn_sign_visit)
    TextView btnSignVisit;

    LoadingDialog loadingDialog;
    IBeforeAndAfterPresenter presenter;

    LoginDialog loginDialog;
    ISafeOperationSignPresenter presenter_sign;

    ClickDialog dialog;

    @Override
    public void setRootView() {
        setContentView(R.layout.act_operationbeforeandafter_beforevisit);
        ButterKnife.bind(this);
        ExitApplication.getInstance().addActivity(this);
    }

    @Override
    public void initData() {
        super.initData();
        loginDialog = new LoginDialog(aty);
        loadingDialog = new LoadingDialog(this);
        presenter = new BeforeAndAfterPresenter(this, new BeforeAndAfterModel());
        presenter_sign = new SafeOperationSignPresenter(this, new SafeOperationSignModel());
        setTitle();
        setContent();
    }

    private void setTitle() {
        tvPatientName.setText(AppConfig.BEFOREANDAFTERBEAN.getObject().getName());
        if (AppConfig.BEFOREANDAFTERBEAN.getObject().getSex().equals("1")) {
            tvPatientSex.setText("男");
        } else if (AppConfig.BEFOREANDAFTERBEAN.getObject().getSex().equals("2")) {
            tvPatientSex.setText("女");
        } else {
            tvPatientSex.setText("不详");
        }
        tvPatientVisitno.setText("住院号" + AppConfig.BEFOREANDAFTERBEAN.getObject().getVisitNo());
        tvPatientDisease.setText(PreferenceHelper.readString(aty, AppConfig.PATIENT_INFO, AppConfig.PATIENT_DISEASE));
    }

    private void setContent() {
        if (AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getSignTime().length() > 0) {
            imgSignVisit.setVisibility(View.VISIBLE);
            btnSignVisit.setVisibility(View.GONE);
            tvSignVisitTime.setVisibility(View.VISIBLE);
            tvSignVisitName.setVisibility(View.VISIBLE);
            Glide.with(aty)
                    .load(AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getSignURL())
                    .placeholder(R.color.white)
                    .error(R.color.white)
                    .into(imgSignVisit);
            tvSignVisitTime.setText("签名时间:" + AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getSignTime());
            tvSignVisitName.setText(AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getSignName());
        }

        bv01.setText(AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getTemperature());
        bv02.setText(AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getPulse());
        bv03.setText(AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getBp());
        bv04.setText(AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getEeg());
        //血常规
        bv0501.setText(AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getRedCell());
        bv0502.setText(AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getWhiteCell());
        bv0503.setText(AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getHemoglobin());
        bv0504.setText(AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getBloodCell());
        bv0505.setText(AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getBloodType());
        bv0506.setText(AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getLiver());
        bv0507.setText(AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getOtherDisease());
        //皮试
        if (AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getSkinTest().equals("0")) {
            bv0601.setChecked(true);
        } else if (AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getSkinTest().equals("1")) {
            bv0602.setChecked(true);
        }
        bv0603.setText(AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getOtherAcroaesthesia());
        //术前准备情况
        if (AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getSkin().equals("0")) {
            bv070101.setChecked(true);
        } else if (AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getSkin().equals("1")) {
            bv070102.setChecked(true);
        } else if (AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getSkin().equals("2")) {
            bv070103.setChecked(true);
        }
        if (AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getFasting().equals("0")) {
            bv0702.setChecked(true);
        }
        if (AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getBladderPrepare().equals("0")) {
            bv0703.setChecked(true);
        }
        if (AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getPremedicate().equals("0")) {
            bv0704.setChecked(true);
        }
        if (AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getPsychology().length() > 0) {
            String[] arrays = AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getPsychology().split(";", -1);
            if (arrays[0].equals("1")) {
                bv070501.setChecked(true);
            }
            if (arrays[1].equals("1")) {
                bv070502.setChecked(true);
            }
            if (arrays[2].equals("1")) {
                bv070503.setChecked(true);
            }
            if (arrays[3].equals("1")) {
                bv070504.setChecked(true);
            }
            if (arrays[4].equals("1")) {
                bv070505.setChecked(true);
            }
            if (arrays[5].equals("1")) {
                bv070506.setChecked(true);
            }
        }
        //健康宣教
        if (AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getHealthEducation().length() > 0) {
            String[] arrays = AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getHealthEducation().split(";", -1);
            if (arrays[0].equals("1")) {
                bv0801.setChecked(true);
            }
            if (arrays[1].equals("1")) {
                bv0802.setChecked(true);
            }
            if (arrays[2].equals("1")) {
                bv0803.setChecked(true);
            }
            if (arrays[3].equals("1")) {
                bv0804.setChecked(true);
            }
            if (arrays[4].equals("1")) {
                bv0805.setChecked(true);
            }
            if (arrays[5].equals("1")) {
                bv0806.setChecked(true);
            }
            if (arrays[6].equals("1")) {
                bv0807.setChecked(true);
                bv0807OtherLl.setVisibility(View.VISIBLE);
                bv0807Other.setText(AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getOtherHealthEducation());
            }
        }
    }


    @OnClick({R.id.titlebar_docadvice_img_back, R.id.titlebar_docadvice_img_back_ll,
            R.id.bv_0601, R.id.bv_0602, R.id.bv_070101, R.id.bv_070102, R.id.bv_070103,
            R.id.bv_0702, R.id.bv_0703, R.id.bv_0704, R.id.bv_070501, R.id.bv_070502, R.id.bv_070503,
            R.id.bv_070504, R.id.bv_070505, R.id.bv_070506, R.id.bv_0801, R.id.bv_0802, R.id.bv_0803,
            R.id.bv_0804, R.id.bv_0805, R.id.bv_0806, R.id.bv_0807, R.id.sure
            , R.id.btn_sign_visit})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.titlebar_docadvice_img_back:
                finish();
                break;
            case R.id.titlebar_docadvice_img_back_ll:
                finish();
                break;
            case R.id.bv_0601:
                break;
            case R.id.bv_0602:
                break;
            case R.id.bv_070101:
                break;
            case R.id.bv_070102:
                break;
            case R.id.bv_070103:
                break;
            case R.id.bv_0702:
                break;
            case R.id.bv_0703:
                break;
            case R.id.bv_0704:
                break;
            case R.id.bv_070501:
                break;
            case R.id.bv_070502:
                break;
            case R.id.bv_070503:
                break;
            case R.id.bv_070504:
                break;
            case R.id.bv_070505:
                break;
            case R.id.bv_070506:
                break;
            case R.id.bv_0801:
                break;
            case R.id.bv_0802:
                break;
            case R.id.bv_0803:
                break;
            case R.id.bv_0804:
                break;
            case R.id.bv_0805:
                break;
            case R.id.bv_0806:
                break;
            case R.id.bv_0807:
                if (bv0807.isChecked()) {
                    bv0807OtherLl.setVisibility(View.VISIBLE);
                } else {
                    bv0807OtherLl.setVisibility(View.GONE);
                }
                break;
            case R.id.sure:
                if(AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getSignName()!=null&&
                AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().getSignName().length()>0) {
                    insertContent();
                }
                else {
                    dialog = new ClickDialog(aty).builder().setTxt("存在未签名,是否提交？");
                    dialog.isCancleBack(true);
                    dialog.setCallBack(new ClickDialog.ICallBack() {
                        @Override
                        public void callback(Bundle bundle) {
                            if(bundle.getInt("data") == 0){
                                insertContent();
                            } else if(bundle.getInt("data") == 1){
                                dialog.dismiss();
                            }

                        }
                    });
                    dialog.show();
                }
                break;
            case R.id.btn_sign_visit:
                showTypeDialog();
                break;
        }
    }

    private void showTypeDialog() {
        ActionSheetDialog actionSheetDialog;
        actionSheetDialog = new ActionSheetDialog(this).builder()
                .setCancelable(true)
                .setCanceledOnTouchOutside(true);
        actionSheetDialog.addSheetItem("HIS签名", ActionSheetDialog.SheetItemColor.Blue,
                new ActionSheetDialog.OnSheetItemClickListener() {
                    @Override
                    public void onClick(int which) {
                        loginDialog.builder();
                        loginDialog.show();
                        loginDialog.setCallBack(new LoginDialog.ICallBack() {
                            @Override
                            public void callback(Bundle bundle) {
                                Map<String, String> params = new HashMap<>();
                                params.put("jobNum", bundle.getString("person_num"));
                                params.put("loginPwd", bundle.getString("person_psw"));
                                presenter_sign.getSignInfo(params);
                            }
                        });
                    }
                });
        actionSheetDialog.addSheetItem("虹膜签名(暂不可用)", ActionSheetDialog.SheetItemColor.Blue,
                new ActionSheetDialog.OnSheetItemClickListener() {
                    @Override
                    public void onClick(int which) {

                    }
                });
        actionSheetDialog.show();
    }

    @Override
    public void getSignInfo(SignBean signBean) {
        loginDialog.dismiss();
        if (signBean.getCode() == 200) {
            if (signBean.getObject().getDoctorType().equals("H")) {
                SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", java.util.Locale.getDefault());
                Date curDate = new Date(System.currentTimeMillis());//获取当前时间
                String str = formatter.format(curDate);
                imgSignVisit.setVisibility(View.VISIBLE);
                Glide.with(this)
                        .load(signBean.getObject().getSignPicture())
                        .placeholder(R.color.white)
                        .error(R.color.white)
                        .into(imgSignVisit);
                btnSignVisit.setVisibility(View.GONE);
                tvSignVisitTime.setVisibility(View.VISIBLE);
                tvSignVisitTime.setText("签名时间:" + str);
                tvSignVisitName.setVisibility(View.VISIBLE);
                tvSignVisitName.setText(signBean.getObject().getDoctorName());

                AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().setSignName(signBean.getObject().getDoctorName());
                AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().setSignURL(signBean.getObject().getSignPicture());
                AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().setSignTime(str);
            } else {
                ViewInject.toast("请使用护士账号进行签名");
            }
        } else {
            ViewInject.toast(signBean.getDesc());
        }
    }

    private void insertContent() {
        AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().setTemperature(bv01.getText().toString());
        AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().setPulse(bv02.getText().toString());
        AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().setBp(bv03.getText().toString());
        AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().setEeg(bv04.getText().toString());
        //
        AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().setRedCell(bv0501.getText().toString());
        AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().setWhiteCell(bv0502.getText().toString());
        AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().setHemoglobin(bv0503.getText().toString());
        AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().setBloodCell(bv0504.getText().toString());
        AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().setBloodType(bv0505.getText().toString());
        AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().setLiver(bv0506.getText().toString());
        AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().setOtherDisease(bv0507.getText().toString());
        //
        if (bv0601.isChecked()) {
            AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().setSkinTest("0");
        }
        if (bv0602.isChecked()) {
            AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().setSkinTest("1");
        }
        AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().setOtherAcroaesthesia(bv0603.getText().toString());
        //
        if (bv070101.isChecked()) {
            AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().setSkin("0");
        }
        if (bv070102.isChecked()) {
            AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().setSkin("1");
        }
        if (bv070103.isChecked()) {
            AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().setSkin("2");
        }
        if (bv0702.isChecked()) {
            AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().setFasting("0");
        }
        if (bv0703.isChecked()) {
            AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().setBladderPrepare("0");
        }
        if (bv0704.isChecked()) {
            AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().setPremedicate("0");
        }
        if (bv070501.isChecked() || bv070502.isChecked() || bv070503.isChecked() ||
                bv070504.isChecked() || bv070505.isChecked() || bv070506.isChecked()) {
            String Psychology = "";
            if (bv070501.isChecked()) {
                Psychology += "1;";
            } else {
                Psychology += ";";
            }

            if (bv070502.isChecked()) {
                Psychology += "1;";
            } else {
                Psychology += ";";
            }

            if (bv070503.isChecked()) {
                Psychology += "1;";
            } else {
                Psychology += ";";
            }

            if (bv070504.isChecked()) {
                Psychology += "1;";
            } else {
                Psychology += ";";
            }

            if (bv070505.isChecked()) {
                Psychology += "1;";
            } else {
                Psychology += ";";
            }

            if (bv070506.isChecked()) {
                Psychology += "1";
            } else {
                Psychology += "";
            }
            AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().setPsychology(Psychology);
        }

        if (bv0801.isChecked() || bv0802.isChecked() || bv0803.isChecked() ||
                bv0804.isChecked() || bv0805.isChecked() || bv0806.isChecked() || bv0807.isChecked()) {
            String arrays = "";
            if (bv0801.isChecked()) {
                arrays += "1;";
            } else {
                arrays += ";";
            }

            if (bv0802.isChecked()) {
                arrays += "1;";
            } else {
                arrays += ";";
            }

            if (bv0803.isChecked()) {
                arrays += "1;";
            } else {
                arrays += ";";
            }

            if (bv0804.isChecked()) {
                arrays += "1;";
            } else {
                arrays += ";";
            }

            if (bv0805.isChecked()) {
                arrays += "1;";
            } else {
                arrays += ";";
            }

            if (bv0806.isChecked()) {
                arrays += "1;";
            } else {
                arrays += ";";
            }

            if (bv0807.isChecked()) {
                arrays += "1";
                AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().setOtherHealthEducation(bv0807Other.getText().toString());
            } else {
                arrays += "";
            }
            AppConfig.BEFOREANDAFTERBEAN.getObject().getBeforeNursing().setHealthEducation(arrays);
        }

        if (AppConfig.BEFOREANDAFTERBEAN.getObject().getObjectId() == null) {
            Map<String, String> params = new HashMap<>();
            params.put("operationNo", PreferenceHelper.readString(aty, AppConfig.PATIENT_INFO, AppConfig.PATIENT_OPERATION_ID) + "");
            params.put("saveData", JSON.toJSONString(AppConfig.BEFOREANDAFTERBEAN.getObject()));
            presenter.insertBeforeAndAfterDate(params);
        } else {
            Map<String, String> params = new HashMap<>();
            params.put("accountId", PreferenceHelper.readInt(aty, AppConfig.USER_INFO, AppConfig.USER_ACCOUNT) + "");
            params.put("fullName", PreferenceHelper.readString(aty, AppConfig.USER_INFO, AppConfig.USER_FULLNAME) + "");
            params.put("saveData", JSON.toJSONString(AppConfig.BEFOREANDAFTERBEAN.getObject()));
            presenter.updateBeforeAndAfterDate(params);
        }
    }


    @Override
    public void insertBeforeAndAfterDate(SubmitBean submitBean) {
        if (submitBean.getCode() == 200) {
            ViewInject.toast("保存成功");
            finish();
        } else {
            ViewInject.toast(submitBean.getDesc());
        }
    }

    @Override
    public void updateBeforeAndAfterDate(SubmitBean submitBean) {
        if (submitBean.getCode() == 200) {
            ViewInject.toast("保存成功");
            finish();
        } else {
            ViewInject.toast(submitBean.getDesc());
        }
    }

    @Override
    public void loadingDialogStatus(int status) {
        switch (status) {
            case AppConfig.SHOW_DIALOG:
                loadingDialog.setCanceledOnTouchOutside(false);
                loadingDialog.show();
                break;
            case AppConfig.DISMISS_DIALOG:
                loadingDialog.dismiss();
                break;

        }
    }
}
